const ln = typeof window == "undefined";
var Ie = {
    get: (e,t)=>{
        var o;
        if (typeof t != "string" && !ln && (t = document.cookie),
        typeof t == "object" && ln && (t = (o = t == null ? void 0 : t.headers) == null ? void 0 : o.cookie),
        !t)
            return "";
        const i = t.split("; ");
        let n = "";
        for (let s = 0; s < i.length; s++) {
            const a = i[s].split("=");
            a[0] === e && (n = a[1])
        }
        return n
    }
    ,
    set: (e,t,i={})=>{
        if (ln)
            return;
        i = Object.assign({}, {
            path: "/"
        }, i),
        typeof i.expires == "number" && (i.expires = new Date(Date.now() + i.expires * 864e5)),
        i.expires && (i.expires = i.expires.toUTCString());
        let n = "";
        for (const o in i)
            !i[o] || (n += "; " + o,
            i[o] !== !0 && (n += "=" + i[o].split(";")[0]));
        document.cookie = e + "=" + t + n
    }
    ,
    remove: e=>{
        if (ln || !document.cookie || !e)
            return;
        const t = document.cookie.split("; ")
          , i = [];
        t.forEach(n=>{
            const o = n.split("=");
            o[0] !== e && i.push(`${o[0]}=${o[1]}`)
        }
        ),
        document.cookie = i.join("; ")
    }
};
// 头部动态视频和专栏接口 update_baseline 参数   ---有出入 暂时有问题
let gi = 0;
const li = {
    allTypeOffset: "",
    videoOffset: "",
    articleOffset: ""
};
export function U1(e) {

    if (e && e !== gi) {
        gi = e;
        let i = Ie.get("bp_t_offset_" + gi)
          , n = Ie.get("bp_video_offset_" + gi)
          , o = Ie.get("bp_article_offset_" + gi);
        li.allTypeOffset = i && i !== "undefined" ? i : 0,
        li.videoOffset = n && n !== "undefined" ? n : 0,
        li.articleOffset = o && o !== "undefined" ? o : 0
    }
    return [li, (i,n)=>{
        let o;
        i === "video" ? (li.videoOffset = n,
        o = "bp_video_offset_") : i === "all" ? (li.allTypeOffset = n,
        o = "bp_t_offset_") : i === "article" && (li.articleOffset = n,
        o = "bp_article_offset_"),
        o && Ie.set(o + gi, n, {
            expires: 30,
            domain: ".bilibili.com"
        })
    }
    ]
}